perm filename TIMSER.MID[S,NET] blob sn#824073 filedate 1986-09-08 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	 TIMSER QUIT OBUF TIME LSNBLK LSNSTS
C00005 ENDMK
C⊗;
;⊗ TIMSER QUIT OBUF TIME LSNBLK LSNSTS

TITLE TIMSER
SUBTTL Mark Crispin, SU-AI, May 1979
;ME TCP May 1983

TIMSER:	JFCL
	RESET
	MOVE ['TIMSER]
	SETNAM
	MOVEI [DEBREAK ? JRST QUIT]
	MOVEM JOBAPR
	CLKINT 30.*60.			; set up death time
	INIT 0				; open in buffered mode
	 'IMP,,				; device IMP:
	 OBUF,,0			; output buffer hdr
	 JRST QUIT
	MOVEI 0,1000
	HRLM 0,OBUF+1			; make 8-bit byte ptr
	MTAPE [17 ? .BYTE 6 ?1?5?5?20?0?0]; set timeouts
	SETZM LSNBLK+4			;accept any port
	SETZM LSNBLK+5			;accept any host
	MTAPE LSNBLK
	MOVE LSNSTS			; check for MTAPE error
	TRNN 77
	 STATZ 763600
	  JRST QUIT
	TLC 300000			; for next instruction to win
	TLCE 300000			; legal socket state?
	 JRST QUIT
	STDTIM 1,			; PST date/time
	HLRZ 1				; date (not SETZ since it may still
	DAYCNT				;  be yesterday
	ADDI 55517			; days from 1/1/00 to 1/1/64
	IMULI 60.*60.*24.		; days → seconds
	ADDI 60.*60.*8.(1)		; add in seconds and GMT/PST offset
	DPB [044000,,TIME]		; time is now left justified in TIME
;	HRROI TIME-1			; get ready to send a socket
;	SETZ 1,				; stop code for dump mode
	OUTPUT
	IBP OBUF+1			; advance byte ptr 4 times to indicate
	IBP OBUF+1			; four bytes ready to ship
	IBP OBUF+1
	IBP OBUF+1
	MOVE 0,TIME			; stick time in first word of buffer
	MOVEM 0,@OBUF+1			; 32 bits is 4 8-bit bytes
	OUTPUT
	RELEAS
QUIT:	RESET
	EXIT				; and that's it

OBUF:	BLOCK 3				; output buffer hdr

TIME:	BLOCK 1				; 32-bit time, left justified

LSNBLK:	1				; LISTEN
LSNSTS:	BLOCK 1				; returned status bits
	37.				; local socket to listen to
	-1				; ≠ 0 → wait for connection
	8.				; byte size
	BLOCK 1				; foreign socket
	BLOCK 1				; foreign host

END TIMSER